function [People, PLI] = PeopleRecruitment(People,fullStaff,TechIndex,Requriment,Tech,time)
% 职位空缺
posPeople = zeros(1,10);
for position=1:10
    posPeople(position) = length(find(People(:,15)==position));
end
Need = fullStaff-posPeople;
PLI = sum(Need/fullStaff);
prob =0.15+10/(2*sqrt(2*pi))*exp(-((time-16).^2)/(2*4));
if rand<prob
    Need = round(Need/max(Need));    %%%%%% 人才招聘比率是一个函数
    if ~all(Need==0)
        for position=1:10
            expect = Need(position);
            Recruited = 0;
            while Recruited<expect
                % 职位空缺
                
                % 技术能力分配
                if ~isnan(TechIndex) && length(find(People(:, TechIndex)>=0.3))<3
                    % 新引进技术配套人才
                    type = Tech(find(Tech(:,2)==TechIndex),1);
                    tech = Tech(find(Tech(:,1)==type),2);
                else
                    techType = Requriment(position,:);
                    tech = [];
                    for type=1:4
                        if techType(type)==1
                            tech = [tech;Tech(find(Tech(:,1)==type),2)];
                        end
                    end
                end
                
                pTech = zeros(1,length(Tech));
                for t=1:length(Tech)
                    if ~isempty(find(tech==t,1))
                        norm = normrnd(0.6, 0.1);
                    else
                        norm = normrnd(0.2, 0.1);
                    end
                    if norm>=0
                        pTech(t) = norm;
                    elseif norm<0
                        pTech(t) = 0;
                    elseif norm>1
                        pTech(t) = 1;
                    end
                end
                
                % 工作时间
                workTime = 0;
                
                % 等级，薪资分配
                Salary = [67377,91127;106992,123680];
                if all(People(find(People(:,15)==position),16)==1)
                    level = 2;
                elseif rand<0.05
                    level = 2;
                else
                    level = 1;
                end
                salary = unifrnd(Salary(level,1),Salary(level,2));
                People = [People;[pTech, workTime, position, level, salary]];
                
                Recruited = Recruited+1;
            end
        end
    end 
end
end

